package com.mall.server.controller.yxcontroller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.commons.R;
import com.mall.server.service.CouponHistoryService;
import com.tanhua.model.domain.SmsCouponHistory;
import com.tanhua.model.vo.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/couponHistory")
public class CouponHistoryController {

    @Autowired
    private CouponHistoryService couponHistoryService;

    /**
     * 根据优惠券id，使用状态，订单编号分页获取领取记录
     * @param couponId
     * @param orderSn
     * @param useStatus
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/brand/list")
    public R couponHistoryList(Long couponId, String orderSn,Integer useStatus,
                       @RequestParam(defaultValue = "1")Integer pageNum,
                       @RequestParam(defaultValue = "5")Integer pageSize){

        Page<SmsCouponHistory> page = new Page<>(pageNum,pageSize);
        PageVo pageVo =couponHistoryService.couponHistoryList(couponId,orderSn,useStatus,page);

        return R.success(pageVo);
    }


}
